package com.example.boot.service.transaction.impl;

import com.example.boot.domain.User;
import com.example.boot.mapper.simple_test.UserMapper;
import com.example.boot.service.transaction.ITransactionService1;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class TransactionServiceI1mpl implements ITransactionService1 {

    @Resource
    private UserMapper userMapper;

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public void addRequiredException(User user2){
        userMapper.insert(user2);
        throw new RuntimeException();
    }
}
